import pymysql

def update_data():
    # 连接数据库
    con = pymysql.connect(host='localhost',port = 3306, user='root', password='root', database='test', charset='utf8')
    # 创建游标
    cur = con.cursor()
    #编写sql语句
    sql = "update emp set salary = salary*1.1"
    # 执行sql语句
    cur.execute(sql)
    # 提交事务
    con.commit()
    # 关闭游标和连接
    cur.close()
    con.close()

if __name__ == '__main__':
    update_data()